#include "../cute_memfile.h"

// generated from poem.txt via incbin (incbin by Richard Mitton)
const unsigned char poem[] = {
	0x74,0x68,0x65,0x20,0x73,0x70,0x69,0x64,0x65,0x72,0x0d,0x0a,0x63,0x72,0x61,0x77,
	0x6c,0x65,0x64,0x20,0x6f,0x6e,0x0d,0x0a,0x75,0x70,0x20,0x74,0x68,0x65,0x20,0x77,
	0x65,0x62,0x0d,0x0a,0x61,0x6e,0x64,0x20,0x73,0x6d,0x69,0x6c,0x65,0x64,0x0d,0x0a,
	0x3a,0x29,0x00
};

int main( )
{
	memfile_t fp;
	char buffer[ 256 ];

	memfile_open_in_memory( &fp, poem, sizeof( poem ) );

	// prints:
	// the spider crawled on up the web and smiled :)
	while ( !memfile_eof( &fp ) )
	{
		memfile_scanf( &fp, "%s", buffer );
		printf( "%s ", buffer );
	}

	// prints:
	// spider
	memfile_seek( &fp, 4 );
	memfile_scanf( &fp, "%s", buffer );
	printf( "%s", buffer );
}
